import React, { Component } from 'react'
import PropTypes from 'prop-types';
import ZPlayer from './Player/index'
import ColumnGroup from 'antd/lib/table/ColumnGroup';

export default class VideoPlayer extends Component {

    componentDidMount() {
    }

    componentDidUpdate() {
        this.dp.switchVideo(
            {
                url: this.props.src
            }
        );
    }

    componentWillUnmount() {
        this.dp.destroy()
    }

    onLoad(dp) {
        this.dp = dp;
    }
    render() {
        return (
            <div style={{ width: '100%', height: '100%' }}>
                <ZPlayer
                    options={{
                        loop: false,
                        // logo: '/img/logo.png',
                        video: {
                            url: this.props.src
                        },
                        frame: true,
                        screenshot: true,
                        prev: this.props.prev,
                        next: this.props.next,
                        ended: this.props.ended
                    }}
                    onLoad={this.onLoad.bind(this)}
                />
            </div>
        )
    }
}
